<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <link href="mui.min.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript">

            function actionFromNative() {
                document.getElementById('log_msg').innerHTML = '<br\>Native调用了js函数'
            }

            function actionFromNativeWithParam(arg) {
                document.getElementById('log_msg_with_args').innerHTML = ('<br\>Native调用了js函数并传递参数：<br\>' + arg)
            }

            function actionFromJsWithParam() {
                window.test.actionFromJsWithParam(document.getElementById('id_input').value);
            }

            function actionFromJsWithReturnValue() {
                document.getElementById('log_msg_with_return_value').innerHTML = ('<br\>Native调用了带返回值的js函数')
                return document.getElementById('id_input').value;
            }
        </script>
    </head>
    <body>
        <div class="mui-content" style="height: 100%;overflow: hidden;padding: 0px;margin: 0px;background-color: #ffffff;">
            <h4>WebView与Javascript交互</h4>
            <br/>
            <div>
                <button class="mui-btn mui-btn-primary" style= "width: 100%" onClick="window.test.actionFromJs()">点击调用Native代码</button>
            </div>
            <br/>
            <div>
                <input id="id_input" class="mui-input-clear" type="text" placeholder="请输入要传递的参数或返回值">
            </div>
            <div>
                <button class="mui-btn mui-btn-primary" style= "width: 100%" onClick="actionFromJsWithParam()">点击调用Native代码并传递参数</button>
            </div>
            <div id="log_msg" style="font-size:14px;"></div>
            <div id="log_msg_with_args" style="font-size:14px;"></div>
            <div id="log_msg_with_return_value" style="font-size:14px;"></div>
        </div>
    </body>
</html>
